package com.ymatou.api.marketingseller.service;

import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.apache.http.client.ClientProtocolException;

import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;

public class SellerPromotionListCall extends YmatouAutoTestCall {
	
	private static String opurl ="/api/Promotion/SellerPromotionList";
	
	public SellerPromotionListCall() {
		super(EnvSetup.getSystemUrl("marketingseller_api"),opurl,"GET","PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Content-Type", "application/json");
	}
	

	public void setData(int sellerId,String PromotionName,Date PromotionBeginTime,Date PromotionEndTime,int PromotionType,int PromotionState,int PageIndex,int PageSize){
		super.setData("sellerId="+sellerId+"&PromotionName="+PromotionName+"&PromotionBeginTime"+PromotionBeginTime+"&PromotionEndTime"+PromotionEndTime+
				"&PromotionType"+PromotionType+"&PromotionState"+PromotionState+"&PageIndex"+PageIndex+"&PageSize"+PageSize);
	}
	
	public void setData(Map<String, Object> paramMap){
		
		String paramStr = "";
		if (paramMap!=null){
			for(String strKey : paramMap.keySet()){
				paramStr = paramStr + "&"+strKey+"="+paramMap.get(strKey);
			}
			paramStr = paramStr.substring(1);
			System.out.print(paramStr);
		}
		super.setData(paramStr);
	}
	
	public static void main(String[] args) throws ClientProtocolException, IOException {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("sellerId", 20239184);
		paramMap.put("PromotionName", "测试");
		paramMap.put("PromotionBeginTime", 2016-10-20);
		paramMap.put("PromotionEndTime", 2016-11-19);
		paramMap.put("PromotionType", -1);
		paramMap.put("PromotionState", -1);
		paramMap.put("PageIndex", 1);
		paramMap.put("PageSize", 20);
		
	}


}
